<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <a href="#/login">点我登录</a>
    <a href="#/register">点我注册</a>
<!--    显示路由的组件-->
    <router-view></router-view>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<!--引入js-->
<script src="https://unpkg.com/vue-router@3.6.5/dist/vue-router.js"></script>

<script>
    //声明组件模板
    const login={
        template:"<h1>用户登录</h1>"
    };
    const register={
        template:"<h1>用户注册</h1>"
    }
    //创建路由对象
    const router=new VueRouter({
        routes:[
            //绑定路径和路由对象
            {path:"/login",component:login},
            {path:"/register",component:register}
        ]
    });

    const app = new Vue({
        el: "#app",
        data: {},
        methods: {},
        components: {},
        router:router //绑定路由对象
    })
</script>
</body>
</html>